<template>
  <el-menu
  :style="{width:!isCollapse  ?  '230px':'64px'}"
    active-text-color="#ffd04b"
    background-color="#545c64"
    class="aside-container" 
    text-color="#fff"
    @open="handleOpen"
    @close="handleClose"
    :collapse="isCollapse"
    :default-active="active"
  >
    <div class="logo-lg">{{!isCollapse ? 'DD陪诊'  :'DD'}}</div>
    <TreeMenu :index="1" :menuData="menuData"/>
  </el-menu>
  <div>
    <!-- 循环渲染菜单 -->
    <div v-for="route in menuRoutes" :key="route.path">
      <router-link :to="route.path">{{ route.meta.name }}</router-link>
    </div>
  </div>
</template>

<script setup>
import { computed } from 'vue';
import { useStore } from 'vuex'; // 确保导入 useStore
import TreeMenu from './Treemenu.vue';
import { useRouter } from 'vue-router';
const router = useRouter();

const store = useStore(); // 初始化 store
const menuData = computed(() => store.state.menu.routerList);
const isCollapse = computed(() => store.state.menu.isCollapse); // 正确访问状态
const active=computed(() => store.state.menu.menuActive)

const handleOpen = () => {};
const handleClose = () => {};
</script>



<style   lang="less" scoped>
.aside-container{
  height: 100%;
  .logo-lg{
    font-size: 24px;
    height: 50px;
    line-height: 50px;
    color: #fff;
    text-align: center;
 
  }
}
</style>
